from langgraph.prebuilt import create_react_agent

from llms import InsCodeChatAI
from prompts.template import apply_prompt_template, get_prompt_template


def create_agent(llm: InsCodeChatAI, tools: list, prompt_template: str):
    graph_agent = create_react_agent(
        llm=llm.llm,
        tools=tools,
        prompt=get_prompt_template(prompt_name=prompt_template)
        # prompt=lambda state: apply_prompt_template(prompt_template, state),
    )

    return graph_agent
